<template>
  <div id="frame">
    <el-row class="header">
      <img class="logo" src="../assets/logo1.png" @click="goHome()"/>
      <div class="exit" @click="exit()">退出</div>
      <h1 class="title">GlobalLove后台管理系统</h1>
    </el-row>
    <el-row :gutter="20" :class="['body']">
      <el-col :span="4" class="sideBar">
        <el-menu default-active="2" class="el-menu-vertical-demo" theme="dark">
          <el-submenu index="1">
            <template slot="title">邮件管理</template>
              <el-menu-item index="1-1">
                <router-link to='/index/email/checkEmail' tag="div" >查看邮件</router-link >
              </el-menu-item>
              <el-menu-item index="1-2">
                <router-link to='/index/email/sendEmail' tag="div" >发送邮件</router-link >
              </el-menu-item>
          </el-submenu>

          <el-submenu index="2" v-if="type==MANAGER">
            <template slot="title">账号管理</template>
              <el-menu-item index="2-1">
                <router-link to='/index/account/operate' tag="div">操作账号</router-link>
              </el-menu-item>
              <el-menu-item index="2-2">
                <router-link to='/index/account/handle' tag="div">处理认证任务</router-link>
              </el-menu-item>
          </el-submenu>
          <el-submenu index="3" v-if="type==MANAGER">
          <template slot="title">活动管理</template>
            <el-menu-item index="3-1">
              <router-link to='/index/activity/checkActivity' tag="div">查看活动</router-link >
            </el-menu-item>
            <!--<el-menu-item index="3-2">
              <router-link to='/index/activity/activityContent' tag="div">活动详情</router-link>
            </el-menu-item>-->
          </el-submenu>
          
          <!--<el-menu-item index="4" v-if="type==MANAGER">
            <router-link to='/index/news' tag="div">资讯管理</router-link >
          </el-menu-item>-->


          <el-menu-item index="5" v-if="type==EXPERT">
            <router-link to='/index/customer' tag="div">客户管理</router-link >
          </el-menu-item>
          <el-menu-item index="6" v-if="type==EXPERT">
            <router-link to='/index/basicInfo' tag="div">基本资料管理</router-link>
          </el-menu-item>
        </el-menu>
      </el-col>
      <el-col :span="20" class="content">
         <router-view></router-view>
      </el-col>
    </el-row>
   
  </div>
</template>

<script>
  export default {
    name: 'frame',
    data(){
      return {
        SUPER:'0',
        MANAGER:'1',
        EXPERT:'2',
        type:'',
      }
    },
    methods:{
      goHome(){
        this.$router.push('/index');
      },
      exit(){
        this.$http({
          method: 'post',
          url: 'log/logout',
          data: {}
        }).then((res)=>{
          sessionStorage.clear();
          this.$router.push('/login');
        }).catch((err)=>{

        })
      }
    },
    created(){
      this.type = sessionStorage.getItem('type');
    }

  }
</script>

<style scoped>
  #frame{
    height: 100%;
  }
  .header{
    height: 4em;
    line-height: 4em;
    background-color: #20a0ff;
    z-index: 2;
  }
  .logo{
    float: left;
    box-sizing: border-box;
    height: 4em;
    padding: 0.4em;
    margin-left: 1.5em;
    cursor: pointer;
  }
  .exit{
    float: right;
    padding-left: 2em;
    padding-right: 2em;
    font-size: 1em;
    color: white;
    cursor: pointer;
  }
  .exit:hover{
    text-shadow: 5px 0px 20px rgba(255, 255, 255, 0.71),-5px 0px 20px rgba(255, 255, 255, 0.71),0px 5px 20px rgba(255, 255, 255, 0.71),0px -5px 20px rgba(255, 255, 255, 0.71);
  }
  .title{
    font-size: 1.5em;
    text-align: center;
    color: white;
  }
  .body,.sideBar{
    height:100%;
  }
  .body{
    margin-top: -4em;
    padding-top: 4em;
    margin-right: 0px!important;
  }
  .sideBar{
    background-color: #1f2d3d;
    padding-right: 0px!important;
    overflow-x: hidden;
  }
  .content{
    padding: 2em 1.2em!important;
  }

</style>